<form>
<?php
if(isset($_POST['modifierCompte'])){
	if(sha1($_POST['oldPassword']) == $_SESSION['password']){
		$infos = $this->modifierCompte();
		echo "<pre class='success'>$infos</pre>";
	} else {
		echo '<pre class="erreurs">Mot de passe incorrecte veuillez recommencer !</pre>';
	}
} else if(isset($_POST['modifierInfos'])){
	$this->modifierInfos();
}
?>
</form>
<?php
if(!empty($this->request->params) && $this->request->params[0]=="compte"){
?>
<form method="post" >
<div class="titre_h1"><h1>Mise à jour du compte</h1></div>
<div class="legend_formulaire"><legend>Modification du compte</legend></div>
	<table class="table table-hover">
    	<tr>
        	<td><label for="email">Email: </label>
            </td><td>

   <input type="email" name="email" value="<?php echo $_SESSION['email'] ?>" required class="form-control"/> </td></tr><tr><td>
    <label  for="password">Nouveau Mot de passe </label></td><td><input type="password" name="newPassword" placeholder='********' class="form-control"/></td></tr><tr><td>
    
    <label>Ancien mot de passe  </label></td><td><input type="password" required name="oldPassword" class="form-control" /></td></tr></table>
    
    <button class="btn btn-success"  type="submit" name="modifierCompte" ><span class="glyphicon glyphicon-ok"> </span>&nbsp;Valider</button>
	<button class="btn btn-danger"  type="reset" >Par défaut</button>
    
<?php 
} else if(!empty($this->request->params) && $this->request->params[0]=="infos") {
	
?>
<form method="post" >
<div class="titre_h1"><h1>Mise à jour du profil</h1></div>
<div class="legend_formulaire"><legend>Hôtel</legend></div>
<table class="table table-hover"><tr><td>
	<label>Nom de l'hôtel </label></td><td><input type="text" value="<?php echo $hotel->nom_hotel ?>" require  name="nom"class="form-control"/></td></tr><tr><td>
        <label>Nombre d'etoile </label></td><td><input type="number" value="<?php echo $hotel->nombre_etoile ?>" required
        name="nombre_etoile" id="nombre_etoile" class="form-control"/></td></tr><tr><td>
        <label>Nombre de chambre </label></td><td><input type="number" value="<?php echo $hotel->nombre_chambre ?>" required
        name="nombre_chambre" id="nombre_chambre" class="form-control"/></td></tr><tr><td>
        <label>Contact téléphonique </label></td><td><input type="tel" value="<?php echo $hotel->telephone_hotel ?>" required 
        name="telephone" id="telephone" class="form-control"/></td></tr><tr><td>
        <label>Site internet </label></td><td><input type="text" value="<?php echo $hotel->site_hotel=="" ? "Non renseigné" : 
		$hotel->site_hotel ?>" name="site" id="site" class="form-control"/></td></tr><tr><td>
        <label>Description </label></td><td>
        <textarea name="description" pattern="^[a-zA-Zéèà, ;0-9]+$" class="form-control"><?php echo $hotel->description_hotel=="" ? "Aucune description..." : $hotel->description_hotel ?></textarea></td></tr></table>
       
        <button   type="submit" name="modifierInfos" class="btn btn-success"><span class="glyphicon glyphicon-ok"> </span>&nbsp;Valider</button>
		<button   type="reset" class="btn btn-danger">Par défaut</button>

<div class="legend_formulaire"><legend>Adresse de l'hôtel</legend></div>
	<input value="<?php echo $adresse->pays;?>" required name="pays" pattern=
    "^[a-zA-Zéèà ]+$" type="hidden"/>
    <table class="table table-hover">
	<tr>
    	<td><label for="adresse">Adresse </label></td>
        <td><input type="text" name="adresse" value="<?php echo $adresse->adresse ?>" class="form-control"
    		id="adresse" required /></td>
    </tr>
    <tr>
    	<td><label  for="code_postal">Code Postal </label></td>
        <td><input type="number" name="code_postal" value="<?php echo $adresse->code_postal ?>"required 
        class="form-control" /></td>
    </tr>
    <tr>
    	<td><label  for="ville">Ville : </label></td>
        <td><input type="text" name="ville" value="<?php echo $adresse->ville ?>" required class="form-control"
    		pattern="^[a-zA-Zéàèù- ]+$"/></td>
    </tr>
</table>
    
    <button   type="submit" name="modifierInfos" class="btn btn-success"><span class="glyphicon glyphicon-ok"> </span>&nbsp;Valider</button>
	<button   type="reset" class="btn btn-danger">Par défaut</button>
    
</fieldset>
</form>
<?php
} else {
		
}
?>